﻿<?xml version="1.0" encoding="utf-8"?>
<Elements xmlns="http://schemas.microsoft.com/sharepoint/">
  <CustomAction
    Id="SP2010WordAutomationConvertButton"
    RegistrationId="101"
    RegistrationType="List"
    Location="CommandUI.Ribbon"
    Sequence="5"
    Rights="EditListItems"
    Title="Convert Document">
    <CommandUIExtension>
      <CommandUIDefinitions>
        <CommandUIDefinition Location="Ribbon.Documents.Manage.Controls._children">
          <Button 
            Id="Ribbon.Documents.Edit.SP2010WAConvertButton"
            Alt="Convert Document"
            Sequence="5"
            Command="SP2010WA_Convert_Button"
            Image32by32="/_layouts/images/lg_icdocx.png"
            Image16by16="/_layouts/images/doc16.gif"
            LabelText="Convert Document"
            TemplateAlias="o1" />
        </CommandUIDefinition>
      </CommandUIDefinitions>
      <CommandUIHandlers>
        <CommandUIHandler 
          Command="SP2010WA_Convert_Button"
          CommandAction="javascript:function convertDocument() {
                            Sys.loadScripts(['/_layouts/SP2010WordAutomation.UI/SP2010WordAutomation.UI.js'], function() {
                              SP2010WordAutomation.UI.ConvertDocument();
                            });
                          }
                          convertDocument();"
          EnabledScript="javascript:function oneOrMoreEnable() { 
                          var items = SP.ListOperation.Selection.getSelectedItems(); 
                          var ci = CountDictionary(items); 
                            return (ci > 0); 
                          } 
                          oneOrMoreEnable();" />
      </CommandUIHandlers>
    </CommandUIExtension>    
  </CustomAction>
  <Control Id="AdditionalPageHead" Sequence="90" ControlSrc="~/_ControlTemplates/SP2010WordAutomation.UI.ascx" />
</Elements>
